﻿@model IEnumerable<ShareIt_MVC3.Models.Resource>

@{
    ViewBag.Title = "Search";
    var colorCheck = true;
}
<div class="post">
<h1>Suche</h1>
<p>
    Die Suche nach @ViewBag.searchString lieferte 
    @if(Model.Count() > 0) { 
        @:folgende Ergebnisse 
    } else { 
        @:leider keine Ergebnisse! 
    }
</p>
@if (Model.Count() > 0)
{
<table>
    <tr>
        <th>
            Titel
        </th>
        <th>
            Autor
        </th>
        <th>
            Kategorie
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{

    if (colorCheck == true)
    {
        
    <tr>
        <td style="color:#000000; background:#CCFFFF" align="center">
            @item.Title
        </td>
        <td style="color:#000000; background:#CCFFFF" align="center">
            @item.Author
        </td>
        <td style="color:#000000; background:#CCFFFF" align="center">
            @item.Category
        </td>
        <td style="color:#000000; background:#CCFFFF" align="center">@Html.ActionLink("Ausleihen!", "Borrow", new { id = item.ID, controller = "MyResources" })</td>
    </tr>
                                                                colorCheck = false;
    }

    else
    {
        <tr>
        <td align="center">
            @item.Title
        </td>
        <td align="center">
            @item.Author
        </td>
        <td align="center">
            @item.Category
        </td>
        <td align="center">@Html.ActionLink("Ausleihen!", "Borrow", new { id = item.ID, controller = "MyResources" })</td>
    </tr>
                      colorCheck = true;
    }
}

</table>
}
</div>